﻿public class Animal
{
    private string kind;
    private string name;

    public Animal(string name, string kind)
    {
        this.name = name;
        this.kind = kind;
    }

    public event AnimalEventHandler NameChanged;

    public string Kind
    {
        get
        {
            return kind;
        }
        set
        {
            kind = value;
        }
    }
    public string Name
    {
        get
        {
            return name;
        }
        set
        {
            if (value != name)
            {
                string oldName = name;
                name = value;
                OnNameChange(oldName, value);                
            }
        }
    }

    private void OnNameChange(string oldName, string newName)
    {
        if (NameChanged != null)
        {
            NameChanged(this, new AnimalEventHandlerArgs(oldName, newName));
        }
    }
}